﻿using Microsoft.AspNetCore.Mvc;
using Shop.ProductService.Services;
using Shop.ProductService.Services.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace Shop.PcWebSite.Controllers
{
    /// <summary>
    /// 应用层控制器
    /// </summary>
    [ApiController]
    [Route("index")]
    public class IndexController : AbpController
    {
        /// <summary>
        /// 此处IProductService服务中的命名空间需要保持与微服务Shop.ProductService一致
        /// </summary>
        public IProductService productService { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<ProductDto> GetProduct()
        {
            //1、查询商品
            Console.WriteLine("查询商品");
            return productService.GetProductsAsync().Result;
        }
    }
}
